package main;

import java.util.Iterator;
import java.util.Set;
import java.util.Timer;

import player.HumanPlayer;
import player.Player;
import board.Board;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
			Iterator iter;
			Set list;
			Board board = new Board();


			//int color=0;
			//std::cout<<(1+!(color)*7)<<std::endl;

			/* Create players */
			Player whitePlayer = new HumanPlayer(0, "Marc");
			Player blackPlayer = new HumanPlayer(1, "Abraham");
			int terminal = 0;
//			Timer *timer = new Timer(mutex,(AIPlayer*) blackPlayer);
//
//			timer->start(NULL);		// starts new thread for time counting
			//brd->cal
			do {
				// White player
				board.printBoardAlternative();
				whitePlayer.makeNextMove(board);


				// Black player
				board.printBoardAlternative();
				blackPlayer.makeNextMove(board);

				terminal = board.terminal();
			} while (terminal==0);

			board.printBoardAlternative();
			if(terminal==1){
				System.out.println("Game finished! DRAW!" );
			} else if(terminal==2){
				System.out.println("Game finished! " + whitePlayer.getName() + " won!" );
			} else if(terminal==3){
				System.out.println("Game finished! " +  blackPlayer.getName() +" won!" );
			}
		}
}
